<%@page import="com.pay.aiyang.server.MD5"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.pay.yeepay.client.service.YeepayService"%>
<%@page import="com.vo.Gateway"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
	String orderid = request.getParameter("orderid");
	String opstate = request.getParameter("opstate");
	String ovalue = request.getParameter("ovalue");
	String systime = request.getParameter("systime");
	String sysorderid = request.getParameter("sysorderid");
	String completiontime = request.getParameter("completiontime");
	String attach = request.getParameter("attach");
	String msg = request.getParameter("msg");
	String sign = request.getParameter("sign");
	Gateway gateway = Gateway.dao.findById(16);
	String MD5key = gateway.getStr("gateway_key");
	String md5Str = "orderid=" + orderid + "&opstate=" + opstate + "&ovalue=" + ovalue + MD5key;
	MD5 md5 = new MD5();
	String MD5info = md5.getMD5ofStr(md5Str).toLowerCase();
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	if(MD5info.equals(sign)){
		if(Succeed.equals("0")){
			YeepayService.service.netcallback("", orderid, "", sdf.format(new Date()), sdf.format(new Date()));
			response.sendRedirect(basePath+"/yeepay/yeeReturn?r6_Order="+orderid);
		}else{
			YeepayService.service.failure(orderid, sdf.format(new Date()));
			response.sendRedirect(basePath+"/yeepay/yeeReturn?r6_Order="+orderid);
		}
	}else{
		out.println("交易签名被篡改!");
	}
%>